<?php
//
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['op']=='main'){
	$return['params']=array();
	$return['params']['keyword']=$_RQ['keyword']?:'';
	$return['groupset']=plugin('jy_weishop')->plugin_setting('groupset');
	if($_RQ['pid']){
		$return['pid']=$_RQ['pid'];
	}else{
		$return['pid']=0;
	}
	$groupspram=array('uniacid'=>$_SESSION['uniacid'],'isshow'=>'1','mid'=>0,'parentid'=>0);
	$groupspram['onepluginname']='jy_mfuwu';
	$return['params']['onepluginname']='jy_mfuwu';
	$return['params']['pcate']=$return['pid'];
	$category=pdo_getall('jy_weishop_goods_group',$groupspram,array(),'','paixu desc');
	foreach($category as &$item){
		$item['childs']=pdo_getall('jy_weishop_goods_group',array('uniacid'=>$_SESSION['uniacid'],'isshow'=>1,'parentid'=>$item['id']),array(),'','paixu desc');
		if(!$return['pid']){
			$return['pid']=$item['id'];
			$return['childs']=$item['childs'];
			$return['nowkey']=0;
			$return['nowchilds']=$item['childs'];
			$return['params']['pcate']=$return['pid']?:$category[0]['id'];
			$return['params']['ccate']=$item['childs'][0]['id'];
		}
	}
	$searchkeyword=$return['pluginset']['keyword'];
	$return['searchkeyword']=explode(';',$searchkeyword);
	$return['category']=$category;
	//推荐
	$groupspram['isrecommand']=1;
	unset($groupspram['parentid']);
	$recommend=pdo_getall('jy_weishop_goods_group',$groupspram);
	$return['recommend']=$recommend;
	if(count($recommend)){
		$return['childs']=$recommend;
		$return['pid']=0;
	}
	set_html('title','项目分类');
	$return['sharedata']=array(
		'title'=>$return['setting']['share_title']?'分类'.$return['setting']['share_title']:'分类-在线维修',
		'desc'=>$return['setting']['share_desc']?$return['setting']['share_desc']:'在线维修，一个属于自己的个人维修！',
		'link'=>custom_url('jy_mfuwu/shop.groups//fromuser='.$_SESSION['uid'].'&pid='.$return['pid'],true),
		'imgUrl'=>ATTACHMENT_URL.$return['setting']['share_image']
	);
	exi($return);
}
?>